<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta name="decorator" content="sysDefault" />
<script type="text/javascript"
	src="${staticPath}/lib/jquery/1.10.2/jquery.js"></script>
<script type="text/javascript">
	$(function() {
		$("input").change();
	})
	function settlement(t) {
		var money = $(t).attr("money");
		var thisVal = $(t).val();
		var lastTd = $(t).closest("tr").find("td:last");
		var firstTd = $(t).closest("tr").find("td:first");
		var sub = thisVal - money;
		if (sub == 0) {
			lastTd.html("OK");
		} else {
			lastTd.html(sub + " " + "<a href='detailList?userNo=" + 1
					+ "&paymodeId=" + firstTd.html() + "'>明细</a>");
		}
	}
</script>
</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<div class="col-xs-12">
				<div class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title">日结对账</h3>

					</div>

					<form action="list" method="post">
						工号：<input name="userNo">
						<button class="btn btn-primary" type="submit">查询</button>
					</form>

					<tags:message content="${message}" />
					<table class="table table-striped table-bordered table-hover">

						<thead>
						</thead>

						<thead>
							<tr>
								<th>支付方式id</th>
								<th>支付方式名字：</th>
								<th>总金额：</th>

								<th>统计</th>

							</tr>
						</thead>
						<tbody>
							<c:forEach items="${settlementList}" var="salePay">
								<tr>
									<td>${salePay.paymodeId }</td>
									<td>${salePay.paymodeName }</td>
									<td><input money="${salePay.paySum}"
										onchange="settlement(this);" /></td>
									<td width="20%"></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>

				</div>
			</div>
		</div>
	</div>
</body>
</html>